<h1>
  <%= render_topic_title(@topic_view.topic) %>
</h1>

<% @breadcrumbs = categories_breadcrumb(@topic_view.topic)
    if @breadcrumbs.present? %>
<div id='breadcrumbs'>
  <% @breadcrumbs.each_with_index do |c,i| %>
    <div id="breadcrumb-<%=i%>" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"
      <%-if (i+1) < @breadcrumbs.length%>
        itemref="breadcrumb-<%=(i+1)%>"
      <%-end%>>
      <a href="<%=c[:url]%>" itemprop="url">
        <span itemprop="title"><%=c[:name]%></span>
      </a>
    </div>
  <% end %>
</div>
<% end %>
<%= server_plugin_outlet "topic_header" %>
<hr>

<% @topic_view.posts.each do |post| %>
  <div itemscope itemtype='http://schema.org/Article'>
    <% if (u = post.user) %>
      <div class='creator'>
        <span>
          <a href='<%= Discourse.base_uri %>/users/<%= u.username %>'><b itemprop='author'><%= u.username %></b></a>
           <%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %>
           <time datetime='<%= post.created_at.to_formatted_s(:iso8601) %>' itemprop='datePublished'>
             <%= post.created_at %>
           </time>
        </span>
        <span itemprop='position'>#<%= post.post_number %></span>
      </div>
      <div class='post' itemprop='articleBody'>
        <%= post.hidden ? t('flagging.user_must_edit').html_safe : post.cooked.html_safe %>
      </div>
      <meta itemprop='interactionCount' content='UserLikes:<%= post.like_count %>'>
      <meta itemprop='interactionCount' content='UserComments:<%= post.reply_count %>'>
      <hr>
    <% end %>
  </div>
<% end %>

<% if @topic_view.prev_page || @topic_view.next_page %>
  <div role='navigation' itemscope itemtype='http://schema.org/SiteNavigationElement'>
    <% if @topic_view.prev_page %>
      <span itemprop='url'><%= link_to t(:prev_page), @topic_view.prev_page_path, rel: 'prev', itemprop: 'name' %></span>
    <% end %>
    <% if @topic_view.next_page %>
      <span itemprop='url'><b><%= link_to t(:next_page), @topic_view.next_page_path, rel: 'next', itemprop: 'name' %></b></span>
    <% end %>
  </div>
<% end %>

<% content_for :head do %>
  <%= auto_discovery_link_tag(@topic_view, {action: :feed, slug: @topic_view.topic.slug, topic_id: @topic_view.topic.id}, title: t('rss_posts_in_topic', topic: @topic_view.title), type: 'application/rss+xml') %>
  <%= crawlable_meta_data(title: @topic_view.title,
                          description: @topic_view.summary,
                          image: @topic_view.image_url) %>
<% end %>

<% content_for(:title) { @topic_view.title } %>
